import java.util.Scanner;


public class P1425 {
    public static void main(String[] args) {

        Scanner time=new Scanner(System.in);
        int a,b;
        int timehourstart=time.nextInt();
        int timeminstart=time.nextInt();
        int timehourend=time.nextInt();
        int timeminend=time.nextInt();
        if(timehourstart<timehourend)
            b=timehourend-timehourstart;
        else  b=timehourstart-timehourend;

        if(timeminstart<timeminend)
            a=timeminend-timeminstart;
        else if(timeminstart==timeminend)
            a=0;
        else  {
            a=60-timeminstart+timeminend;
            b=b-1;
        }
        if(b==-1)
            b=0;
        System.out.print(b+" ");
        System.out.print(a+" ");





    }
}